package com.itheima.dao;

import java.util.Scanner;

/*
* 数组基本查找
* */
public class Arr7 {
    public static void main(String[] args) {
        int [] arr={23,55,77,45,34};
        Scanner sc= new Scanner(System.in);
        System.out.println("请输入您要查找的数");
        int num = sc.nextInt();
        int index=-1;
        //遍历查找您输入的数字索引位置
        for (int i = 0; i < arr.length; i++) {
            //判断在数组中
            if (num==arr[i]){
                index=i;
                break;
            }
        }
        System.out.println(index);
    }

}
